<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="com.lagou.service.ClassService" %>
<%@ page import="com.lagou.bean.Student" %>
<%@ page import="java.util.List" %>
<%@ page import="com.lagou.bean.Class" %><%--
  Created by IntelliJ IDEA.
  User: 92592
  Date: 2021/7/25
  Time: 18:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>主页面</title>
    <link href="./css/bootstrap.min.css" rel="stylesheet"/>
    <script src="./js/jquery-3.3.1.min.js" type="text/javascript"></script>
    <script src="./js/bootstrap.min.js" type="text/javascript"></script>
    <style>
        #d1 {
            text-align: justify;
        }
    </style>
</head>
<body>
<div class="jumbotron text-center" style="margin-bottom:0">
    <h1>班级管理系统</h1>
</div>
<nav class="navbar navbar-default" role="navigation">
    <div class="container-fluid">
        <div class="navbar-header">
            <a class="navbar-brand" href="${pageContext.request.contextPath}/ClassServlet" >班级信息</a>
        </div>
        <div>
            <ul class="nav navbar-nav">
                <li class="active"><a href="#"  data-toggle="modal" data-target="#myModal">创建班级</a></li>
                <li><a href="#" data-toggle="modal" data-target="#delModal">删除班级</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        查看班级
                        <b class="caret"></b>
                    </a>
                    <ul class="dropdown-menu">
                        <c:forEach var="c" items="${classes}">
                            <li><a href="#">${c.cname}</a></li>
                        </c:forEach>

                    </ul>
                </li>
            </ul>
        </div>
    </div>
</nav>
<!-- 表格显示班级信息-->
<table class="table table-hover">
    <caption>班级信息</caption>

    <thead>
    <tr>
        <th>班级名称</th>
        <th>年级</th>
        <th>班主任名称</th>
        <th>班级口号</th>
        <th>班级人数</th>
    </tr>
    </thead>
    <tbody>
        <c:forEach var="c" items="${classes}">
            <tr>
                <td>
                    ${c.cname}
                </td>
                <td>
                        ${c.grade}
                </td>
                <td>
                        ${c.teacher}
                </td>
                <td>
                        ${c.slogan}
                </td>
                <td>
                        ${c.num}
                </td>
            </tr>
        </c:forEach>
    </tbody>
</table>

<!-- 声明定义添加模态框  组件 -->
<div class="modal" id="myModal" data-backdrop="static">
    <!-- 窗口声明 -->
    <div class="modal-dialog">
        <!-- 内容声明 -->
        <div class="modal-content">
            <!-- 1.框的标题 -->
            <div class="modal-header">
                <button class="close" data-dismiss="modal">
                    <span>&times;</span>
                </button>
                <h4 class="modal-title">添加班级</h4>
            </div>
            <!-- 2.框内信息 -->
            <div class="modal-body">
                <form action="addClassServlet" method="post">
                    <div class="form-group">
                        <label>班级名称</label>
                        <input type="text" class="form-control" id="id" name="cname">
                    </div>
                    <div class="form-group">
                        <label>年级</label>
                        <input type="text" class="form-control" id="name" name="grade">
                    </div>
                    <div class="form-group">
                        <label>老师</label>
                        <input type="text" class="form-control" id="sex" name="teacher">
                    </div>
                    <div class="form-group">
                        <label>班级口号</label>
                        <input type="text" class="form-control" id="birthday" name="slogan">
                    </div>

                    <!-- 3.框的按钮 -->
                    <div class="modal-footer" id="sub">
                        <input type="submit">
                    </div>
                </form>
            </div>

        </div>
    </div>
</div>
<!-- 声明定义删除模态框组件 -->
<div class="modal" id="delModal" data-backdrop="static">
    <!-- 窗口声明 -->
    <div class="modal-dialog">
        <!-- 内容声明 -->
        <div class="modal-content">
            <!-- 1.框的标题 -->
            <div class="modal-header">
                <button class="close" data-dismiss="modal">
                    <span>&times;</span>
                </button>
                <h4 class="modal-title">删除班级</h4>
            </div>
            <!-- 2.框内信息 -->
            <div class="modal-body">
                <form action="DeleteClassServlet" method="post">
                    <div class="form-group">
                        <label>请输入要删除的班级名称</label>
                        <input type="text" class="form-control" name="del">
                    </div>

                    <!-- 3.框的按钮 -->
                    <div class="modal-footer">
                        <input type="submit" value="删除">
                    </div>
                </form>
            </div>

        </div>
    </div>
</div>
</body>
</html>
